docs: fix shared library compilation error
authorAlfie John <alfie@alfie.wtf>
Mon, 13 Apr 2015 12:36:32 +0000 (22:36 +1000)
committerAlfie John <alfie@alfie.wtf>
Mon, 13 Apr 2015 12:44:28 +0000 (22:44 +1000)
Currently getting:

note: /usr/bin/ld: /home/alfie/tmp/test/target/debug/build/test-39af07f97c17512a/out/libhello.a(hello.o):
relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC

src/doc/build-script.md

index 61c4840789fb7347069352d54e26bfcd9bacb623..c00362de4460a998339d92c9d9bdc36f7c12286b 100644 (file)
@@ -312,7 +312,7 @@ fn main() {
 
     // note that there are a number of downsides to this approach, the comments
     // below detail how to improve the portability of these commands.
-    Command::new("gcc").args(&["src/hello.c", "-c", "-o"])
+    Command::new("gcc").args(&["src/hello.c", "-c", "-fPIC", "-o"])
                        .arg(&format!("{}/hello.o", out_dir))
                        .status().unwrap();
     Command::new("ar").args(&["crus", "libhello.a", "hello.o"])